<?php

/**
 * 前台 首页 模块 Controller
 * ============================================================================
 * TBlog TBlog博客系统　BY Tmac PHP MVC framework
 * $Author: zwt007 $  <zwttmac@qq.com>
 * $Id: index.php 145 2013-01-22 17:54:45Z zwt007 $
 * http://www.t-mac.org；
 */
class indexAction extends Action
{

    private $tmp_model;
    private $category_model;
    private $config;

    public function _init()
    {
        $this->tmp_model = Tmac::model('index');
        $this->category_model = Tmac::model('category');
        $this->config = $this->tmp_model->getCommon();
        //取导航条的内容并缓存起来，缓存时间1天
        $cat_list = Tmac::getCache('cat_list', array($this->category_model, 'getCategoryList'), array(0), 86400);
        $array['config'] = $this->config;
        $array['cat_list'] = $cat_list;
        $this->assign($array);
    }

    public function index()
    {
        //TODO 上传图片并返回图片url        
        /*
$data_dir = 'D:/upfile/temupload/';
$image = new Image($data_dir, '');
$image->thumb('D:\imgs.jpg', 'D:\imga.jpg\sf.png', 0, 0, 50);
die;
         * 
         */
        /* $exif = @exif_read_data('D:/DSCI2077.JPG', 'IFD0');
          var_dump($exif);die; */        
        $article_list_array = $this->tmp_model->getArticleList(null, $this->config['cfg_indexurl'] . 'page/');
        var_dump($article_list_array);die;
        $array['result'] = $article_list_array;
        $this->assign($array);
        $this->V();
    }

}